<%@ page language="java" contentType="text/html;charset=UTF-8"
   	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<LINK REL="SHORTCUT ICON" HREF="images/icon.jpg"> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<form action="search_videos.html" method="post">
	<table cellpadding="0" cellspacing="0" border="0" width="770" align="center">
		<tr>
			<td width="25" style="border-right: #AAA solid 1px;"> </td>
			<td valign="middle" align="left" height="25" class="tableheader" style="border-top: #AAA solid 1px; border-bottom: #AAA solid 1px;">
				<c:if test="${fn:length(searchtitle)>0}">
					<c:out value="${searchtitle}"></c:out> 
				</c:if>
				<c:if test="${fn:length(searchtitle)<=0}">
					លទ្ធផលដែលបានរកឃើញ
				</c:if>
			</td>
			<td width="25" width="25" style="border-left: #AAA solid 1px;"> </td>
		</tr>
		<tr>
			<td style="border-right: #CCC solid 1px;"></td>
			<td>&nbsp;</td>
			<td style="border-left: #CCC solid 1px;"></td>
		</tr>
		<c:if test="${item==0}">
			<c:if test="${fn:length(videos)>0}">
				<c:forEach var="i" begin="0" end="${fn:length(videos)-1}" step="1" varStatus ="status">
					<tr>
							<td style="border-right: #CCC solid 1px;"></td>	
							<td height="120" align="left" style="padding-left:15px;padding-right:15px;" valign="middle"> 
									<a href="play_video.html?video_id=${videos[i].FILE_ID}"><img hspace="10" src="${videos[i].IMAGE_PATH}${videos[i].IMAGE_NAME}" align="left" height=100px width=150px></a>
									<a href="play_video.html?video_id=${videos[i].FILE_ID}"><b><c:out value="${videos[i].FILE_TITLE}"></c:out></b></a><br>
									<c:choose>
										<c:when test="${fn:length(videos[i].FILE_DESC)>=450}">
											<c:out value="${fn:substring(videos[i].FILE_DESC,0,450)}"/>...
										</c:when>
										<c:otherwise>
											<c:out value="${videos[i].FILE_DESC}"/>
										</c:otherwise>
									</c:choose>
							</td>
							<td style="border-left: #CCC solid 1px;"></td>
					</tr>
				</c:forEach>
			</c:if>
			
			<c:if test="${fn:length(courses)>0}">
				<c:forEach var="i" begin="0" end="${fn:length(courses)-1}" step="1" varStatus ="status">
					<tr>
							<td style="border-right: #CCC solid 1px;"></td>	
							<td align="left" style="padding-left:15px;padding-right:15px;" valign="middle"> 
									<a href="view_course.html?course_id=${courses[i].COURSE_ID}"><b><c:out value="${courses[i].COURSE_NAME}"></c:out></b></a><br>
									<c:choose>
										<c:when test="${fn:length(courses[i].COURSE_DESC)>=350}">
											<c:out value="${fn:substring(courses[i].COURSE_DESC,0,350)}"/>...
										</c:when>
										<c:otherwise>
											<c:out value="${courses[i].COURSE_DESC}"/>
										</c:otherwise>
									</c:choose>
							</td>
							<td style="border-left: #CCC solid 1px;"></td>
					</tr>
					<tr>
						<td style="border-right: #CCC solid 1px;"></td>
						<td>&nbsp;</td>
						<td style="border-left: #CCC solid 1px;"></td>
					</tr>
				</c:forEach>
			</c:if>
			
			
			<c:if test="${fn:length(articles)>0}">
				<c:forEach var="i" begin="0" end="${fn:length(articles)-1}" step="1" varStatus ="status">
					<tr>
							<td style="border-right: #CCC solid 1px;"></td>	
							<td align="left" style="padding-left:15px;padding-right:15px;" valign="middle"> 
									<a href="view_course.html?course_id=${articles[i].ARTICLE_ID}"><b><c:out value="${articles[i].ARTICLE_TITLE}"></c:out></b></a><br>
									<c:choose>
										<c:when test="${fn:length(articles[i].ARTICLE_DESC)>=350}">
											<c:out value="${fn:substring(articles[i].ARTICLE_DESC,0,350)}"/>...
										</c:when>
										<c:otherwise>
											<c:out value="${articles[i].ARTICLE_DESC}"/>
										</c:otherwise>
									</c:choose>
							</td>
							<td style="border-left: #CCC solid 1px;"></td>
					</tr>
					<tr>
						<td style="border-right: #CCC solid 1px;"></td>
						<td>&nbsp;</td>
						<td style="border-left: #CCC solid 1px;"></td>
					</tr>
				</c:forEach>
			</c:if>
			
			
			<c:if test="${fn:length(files)>0}">
				<c:forEach var="i" begin="0" end="${fn:length(files)-1}" step="1" varStatus ="status">
					<tr>
							<td style="border-right: #CCC solid 1px;"></td>	
							<td align="left" style="padding-left:15px;padding-right:15px;" valign="middle"> 
									<a href="view_file_detail.html?file_id=${files[i].FILE_ID}"><b><c:out value="${files[i].FILE_TITLE}"/></b></a><br>
									<c:choose>
										<c:when test="${fn:length(files[i].FILE_DESC)>=350}">
											<c:out value="${fn:substring(files[i].FILE_DESC,0,350)}"/>...
										</c:when>
										<c:otherwise>
											<c:out value="${files[i].FILE_DESC}"/>
										</c:otherwise>
									</c:choose>
							</td>
							<td style="border-left: #CCC solid 1px;"></td>
					</tr>
					<tr>
						<td style="border-right: #CCC solid 1px;"></td>
						<td>&nbsp;</td>
						<td style="border-left: #CCC solid 1px;"></td>
					</tr>
				</c:forEach>
			</c:if>
			
			<c:if test="${fn:length(videos)==0 && fn:length(courses)==0 && fn:length(artcles)==0 && fn:length(files)==0}">
				<tr valign="middle">
					<td style="border-right: #CCC solid 1px;"></td>
					<td width="720" align="center">សូមអភ័យទោស ពុំមានលទ្ធផលសំរាប់បង្ហាញទេ</td>
					<td width="25" style="border-left: #CCC solid 1px;"> </td>
				</tr>
			</c:if>	
			
			
		</c:if>
		<c:if test="${item==1}">
			<c:if test="${fn:length(searches)>0}">
				<c:forEach var="i" begin="0" end="${fn:length(searches)-1}" step="1" varStatus ="status">
					<tr>
							<td style="border-right: #CCC solid 1px;"></td>	
							<td height="120" align="left" style="padding-left:15px;padding-right:15px;" valign="middle"> 
									<a href="play_video.html?video_id=${searches[i].FILE_ID}"><img hspace="10" src="${searches[i].FILE_PATH}/Images/${searches[i].IMAGE_NAME}" align="left" height=100px width=150px></a>
									<a href="play_video.html?video_id=${searches[i].FILE_ID}"><b><c:out value="${searches[i].FILE_TITLE}"></c:out></b></a><br>
									<c:choose>
										<c:when test="${fn:length(searches[i].FILE_DESC)>=450}">
											<c:out value="${fn:substring(searches[i].FILE_DESC,0,450)}"/>...
										</c:when>
										<c:otherwise>
											<c:out value="${searches[i].FILE_DESC}"/>
										</c:otherwise>
									</c:choose>
							</td>
							<td style="border-left: #CCC solid 1px;"></td>
					</tr>
				</c:forEach>
			</c:if>
			<c:if test="${fn:length(searches)==0}">
				<tr>
					<td style="border-right: #CCC solid 1px;"></td>
					<td width="720"​​ align="center">សូមអភ័យទោស ពុំមានលទ្ធផលសំរាប់បង្ហាញទេ</td>
					<td width="25" style="border-left: #CCC solid 1px;"> </td>
				</tr>
			</c:if>	
		</c:if>
		
		<c:if test="${item==2}">
			<c:if test="${fn:length(searches)>0}">
				<c:forEach var="i" begin="0" end="${fn:length(searches)-1}" step="1" varStatus ="status">
					<tr>
							<td style="border-right: #CCC solid 1px;"></td>	
							<td align="left" style="padding-left:15px;padding-right:15px;" valign="middle"> 
									<a href="view_course.html?course_id=${searches[i].COURSE_ID}"><b><c:out value="${searches[i].COURSE_NAME}"></c:out></b></a><br>
									<c:choose>
										<c:when test="${fn:length(searches[i].COURSE_DESC)>=350}">
											<c:out value="${fn:substring(searches[i].COURSE_DESC,0,350)}"/>...
										</c:when>
										<c:otherwise>
											<c:out value="${searches[i].COURSE_DESC}"/>
										</c:otherwise>
									</c:choose>
							</td>
							<td style="border-left: #CCC solid 1px;"></td>
					</tr>
					<tr>
						<td style="border-right: #CCC solid 1px;"></td>
						<td>&nbsp;</td>
						<td style="border-left: #CCC solid 1px;"></td>
					</tr>
				</c:forEach>
			</c:if>
			<c:if test="${fn:length(searches)==0}">
				<tr>
					<td style="border-right: #CCC solid 1px;"></td>
					<td width="720" align="center">សូមអភ័យទោស ពុំមានលទ្ធផលសំរាប់បង្ហាញទេ</td>
					<td width="25" style="border-left: #CCC solid 1px;"> </td>
				</tr>
			</c:if>	
		</c:if>
		
		
		<c:if test="${item==3}">
			<c:if test="${fn:length(searches)>0}">
				<c:forEach var="i" begin="0" end="${fn:length(searches)-1}" step="1" varStatus ="status">
					<tr>
							<td style="border-right: #CCC solid 1px;"></td>	
							<td align="left" style="padding-left:15px;padding-right:15px;" valign="middle"> 
									<a href="view_course.html?course_id=${searches[i].ARTICLE_ID}"><b><c:out value="${searches[i].ARTICLE_TITLE}"></c:out></b></a><br>
									<c:choose>
										<c:when test="${fn:length(searches[i].ARTICLE_DESC)>=350}">
											<c:out value="${fn:substring(searches[i].ARTICLE_DESC,0,350)}"/>...
										</c:when>
										<c:otherwise>
											<c:out value="${searches[i].ARTICLE_DESC}"/>
										</c:otherwise>
									</c:choose>
							</td>
							<td style="border-left: #CCC solid 1px;"></td>
					</tr>
					<tr>
						<td style="border-right: #CCC solid 1px;"></td>
						<td>&nbsp;</td>
						<td style="border-left: #CCC solid 1px;"></td>
					</tr>
				</c:forEach>
			</c:if>
			<c:if test="${fn:length(searches)==0}">
				<tr>
					<td style="border-right: #CCC solid 1px;"></td>
					<td width="720" align="center">សូមអភ័យទោស ពុំមានលទ្ធផលសំរាប់បង្ហាញទេ</td>
					<td width="25" style="border-left: #CCC solid 1px;"> </td>
				</tr>
			</c:if>
		</c:if>
		
		
		<c:if test="${item==4}">
				<c:if test="${fn:length(searches)>0}">
				<c:forEach var="i" begin="0" end="${fn:length(searches)-1}" step="1" varStatus ="status">
					<tr>
							<td style="border-right: #CCC solid 1px;"></td>	
							<td align="left" style="padding-left:15px;padding-right:15px;" valign="middle"> 
									<a href="view_file_detail.html?file_id=${searches[i].FILE_ID}"><b><c:out value="${searches[i].FILE_TITLE}"/></b></a><br>
									<c:choose>
										<c:when test="${fn:length(searches[i].FILE_DESC)>=350}">
											<c:out value="${fn:substring(searches[i].FILE_DESC,0,350)}"/>...
										</c:when>
										<c:otherwise>
											<c:out value="${searches[i].FILE_DESC}"/>
										</c:otherwise>
									</c:choose>
							</td>
							<td style="border-left: #CCC solid 1px;"></td>
					</tr>
					<tr>
						<td style="border-right: #CCC solid 1px;"></td>
						<td>&nbsp;</td>
						<td style="border-left: #CCC solid 1px;"></td>
					</tr>
				</c:forEach>
			</c:if>
			<c:if test="${fn:length(searches)==0}">
				<tr>
					<td style="border-right: #CCC solid 1px;"></td>
					<td width="720" align="center">សូមអភ័យទោស ពុំមានលទ្ធផលសំរាប់បង្ហាញទេ</td>
					<td width="25" style="border-left: #CCC solid 1px;"> </td>
				</tr>
			</c:if>
		</c:if>
		<tr>
			<td style="border-right: #CCC solid 1px;"></td>
			<td height="10" >&nbsp;</td>
			<td style="border-left: #CCC solid 1px;"></td>
		</tr>
		<tr>
		<td></td>
		<td style="border-top: #CCC solid 1px;"> </td>
		<td></td>
	</tr>
</table>
</form>
</body>
</html>